#pragma once
#include <iostream>
#include <mutex>
#include "Common.hpp"
using namespace std;

//单例饿汉模式去实现 为了让所有的线程访问到的都是同一份资源

class CentralCache{
public:
    static CentralCache* create()
    {
        return &_Cen;
    }
    size_t FetchRangeObj(void*& start,void*& end,size_t n,size_t size);
    Span* GetOneSpan(SpanList& list,size_t size);
    void ReleaselisttoSpan(void* start,size_t size);
private:
    //需要将构造拷贝构造拷贝赋值私有化
    CentralCache(){};
    CentralCache(const CentralCache& other) = delete;
    CentralCache& operator=(const CentralCache& other) = delete;
    static CentralCache _Cen;
    SpanList _spanlist[Bucket_Num];
};